home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 151-175 / disk_160 / m4 / hash.m4 < prev    next >
M4 Source File  |  1992-05-06  |  425b  |  18 lines

  1. dnl    This probably will not run on any m4 that cannot
  2. dnl    handle char constants in eval.
  3. dnl
  4. changequote(<,>) define(HASHVAL,99) dnl
  5. define(hash,<eval(str(substr($1,1),0)%HASHVAL)>) dnl
  6. define(str,
  7.     <ifelse($1,",$2,
  8.         <str(substr(<$1>,1),<eval($2+'substr($1,0,1)')>)>)
  9.     >) dnl
  10. define(KEYWORD,<$1,hash($1),>) dnl
  11. define(TSTART,
  12. <struct prehash {
  13.     char *keyword;
  14.     int   hashval;
  15. } keytab[] = {>) dnl
  16. define(TEND,<    "",0
  17. };>) dnl
  18.